

var Misc = {

  _COMMA_SEPARATOR : ",",
  _ERROR_NOT_SN    : "Error Not SN Model Id",

  /**
  * Construct the SN entry window
  *
  * @param string   parentModelId   Opener modelId
  * @param string   srcModel        this source composited model Name
  * @param string   srcModelId      this source composited model id
  * @param string   srcQty
  * @param string   srcWhs
  * @param string   tmpJid
  * @param string   srcHostIp
  */
  txWindowCompos : function (parentModelId,
                             srcModel,
                             srcModelId,
			                       srcQty,
			                       tmpJid,
			                       srcWhs,
			                       srcHostIp){
    
    /**
    * check if SN-ed
    */
    var ret = Ajax.isModelIdSN(srcModelId);

    if(ret == true){
    
      var _BASE_HTML = "http://"+ srcHostIp  + "/ecs/tocmenu_611/views/snComposEntry.php";
    
      /**
      * Fetch the opener properties
      *
      */
      var _HEIGHT = 400 + this._COMMA_SEPARATOR;
      var _WIDTH  = 400 + this._COMMA_SEPARATOR;
      
      window.open((_BASE_HTML  +
                   "?parentModelId="  + parentModelId +
                   "&srcModel="       + srcModel      +
                   "&srcModelId="     + srcModelId    +
                   "&srcQty="         + srcQty        +
                   "&srcWhs="         + srcWhs        +
                   "&tmpJid="         + tmpJid),
                   
                  "Serial Number "+ srcModelId +" Entry",
                  
                  ("height=" + _HEIGHT + 
                   "width="  + _WIDTH  + 
                   "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizeable=1"));
    }else{
    
      /* Do nothing */
      /* alert(this._ERROR_NOT_SN); */
    }
  },

  /**
  * Construct the SN entry window
  *
  * @param string   modelEnt
  * @param string   modelIdEnt
  * @param string   srcQty
  * @param string   tmpJid
  * @param string   srcWhs
  * @param string   srcHostIp
  */
  snEntry2 : function (modelEnt,
                       modelIdEnt,
                       srcQty,
                       tmpJid,
                       srcWhs,
                       srcHostIp){
    
    /**
    * check if SN-ed
    */
    var ret = Ajax.isModelIdSN(modelIdEnt);

    if(ret == true){
    
      var _BASE_HTML = "http://"+ srcHostIp  + "/ecs/tocmenu_611/views/snEntry.php";
    
      /**
      * Fetch the opener properties
      *
      */
      var _HEIGHT = 400 + this._COMMA_SEPARATOR;
      var _WIDTH  = 400 + this._COMMA_SEPARATOR;
      
      hdlChild = window.open((_BASE_HTML  +
                              "?model="   + modelEnt    +
                              "&modelId=" + modelIdEnt  +
                              "&srcQty="  + srcQty      +
                              "&srcWhs="  + srcWhs      +
                              "&tmpJid="  + tmpJid),
                              
                             "Serial Number "+ modelIdEnt +" Entry",
                             
                             ("height=" + _HEIGHT + 
                              "width="  + _WIDTH  + 
                              "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizeable=1"));
    }else{
    
      alert(this._ERROR_NOT_SN);
    }
  },

  /**
  * Construct the SN entry window
  *
  * @param HtmlCollection   modelEnt
  * @param HtmlCollection   modelIdEnt
  * @param HtmlCollection   srcQty
  * @param string           tmpJid
  * @param HtmlCollection   srcWhs
  * @param string           srcHostIp
  */
  snEntry : function (modelEnt,
                      modelIdEnt,
                      srcQty,
                      tmpJid,
                      srcWhs,
                      srcHostIp){
                      
    modelEnt    = document.getElementsByName(modelEnt);
    modelIdEnt  = document.getElementsByName(modelIdEnt);
    srcQty      = document.getElementsByName(srcQty);
    srcWhs      = document.getElementsByName(srcWhs);
    
    modelEnt    = GMisc.firstElement(modelEnt);
    modelIdEnt  = GMisc.firstElement(modelIdEnt);
    srcQty      = GMisc.firstElement(srcQty);
    srcWhs      = GMisc.firstElement(srcWhs);
    
    /**
    * check if SN-ed
    */
    var ret = Ajax.isModelIdSN(modelIdEnt.value);

    if(ret == true){
    
      var _BASE_HTML = "http://"+ srcHostIp  + "/ecs/tocmenu_611/views/snEntry.php";
    
	    /**
	    * Fetch the opener properties
	    *
	    */
	    var _HEIGHT = 400 + this._COMMA_SEPARATOR;
	    var _WIDTH  = 400 + this._COMMA_SEPARATOR;
	    
	    hdlChild = window.open((_BASE_HTML  +
	                            "?model="   + modelEnt.value   +
                              "&modelId=" + modelIdEnt.value +
	                            "&srcQty="  + srcQty.value     +
	                            "&srcWhs="  + srcWhs.value     +
	                            "&tmpJid="  + tmpJid),
	                            
	                           "Serial Number "+ modelIdEnt.value +" Entry",
	                           
	                           ("height=" + _HEIGHT + 
	                            "width="  + _WIDTH  + 
	                            "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizeable=1"));
    }else{
    
      alert(this._ERROR_NOT_SN);
    }
  },

  sayHello : function(){
  
    alert("Misc Linked");
  }
} 